package com.onlineMIS.ORM.entity.headQ.report;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
import com.onlineMIS.common.ExcelTemplate;

public class HeadqUnitReportTemplate extends ExcelTemplate {
		
	private List<HeadQUnitSalesReportVO> list = new ArrayList<HeadQUnitSalesReportVO>();

	public HeadqUnitReportTemplate(String templateWorkbookPath,List<HeadQUnitSalesReportVO> list) throws IOException {
		super(templateWorkbookPath);
		this.list =  list;
	}
	
	
	public HSSFWorkbook process() {
		HSSFSheet sheet = templateWorkbook.getSheetAt(0);

		for (int i = 0; i < list.size(); i++) {
			HeadQUnitSalesReportVO item = list.get(i);
			Row row = sheet.createRow(i + 1);
			row.createCell(0).setCellValue(item.getClientId());
			row.createCell(1).setCellValue(item.getClientName());
			row.createCell(2).setCellValue(item.getStoreName()); 
			row.createCell(3).setCellValue(item.getTotalQuantity()); 
			row.createCell(4).setCellValue(item.getTotalRecCost()); 		
			row.createCell(5).setCellValue(item.getTotalWholePrice()); 
			row.createCell(6).setCellValue(item.getTotalQuantityR()); 
			row.createCell(7).setCellValue(item.getTotalRecCostR()); 
			row.createCell(8).setCellValue(item.getTotalWholePriceR()); 
			row.createCell(9).setCellValue(item.getSumQuantity()); 
			row.createCell(10).setCellValue(item.getSumWholePrice()); 
			
			row.createCell(11).setCellValue(item.getDmQuantity());
			row.createCell(12).setCellValue(item.getdmQuantityR());
			row.createCell(13).setCellValue(item.getSumDmQuantity());
			
			row.createCell(14).setCellValue(item.getDmNetSalesAmount());
			row.createCell(15).setCellValue(item.getDmNetSalesAmountR());
			row.createCell(16).setCellValue(item.getSumDmNetSalesAmount());
			
			row.createCell(17).setCellValue(item.getMdQuantiry());
			row.createCell(18).setCellValue(item.getMdQuantiryR());
			row.createCell(19).setCellValue(item.getSumMdQuantity());
			
			row.createCell(20).setCellValue(item.getMdNetSalesAmount());
			row.createCell(21).setCellValue(item.getMdNetSalesAmountR());
			row.createCell(22).setCellValue(item.getSumMdNetSalesAmount());
		}
		return templateWorkbook;
	}

}
